home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / compresn / dvpeg / src1b / point.asm < prev    next >
Encoding:
Assembly Source File  |  1992-06-07  |  1.6 KB  |  82 lines

  1.  
  2.     include    model.h
  3.  
  4. ;
  5. ;    VGAKIT Version 4.1
  6. ;
  7. ;    Copyright 1988,89,90,91 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    POINT.ASM
  11. ;    removed point13, range checking (Eric P)
  12. ;
  13. ;
  14. .data
  15.  
  16.     extrn    curbk:word
  17.     extrn    maxx:word,maxy:word,xwidth:word
  18.  
  19. .code
  20.  
  21.     extrn    newbank:proc
  22.  
  23.     public    point
  24.     public    point_hi        ; hi color Tseng 4000 support
  25.  
  26. point_hi    proc    xpos:word,ypos:word,color:word
  27.     mov    bx,[xpos]
  28.     mov    ax,[ypos]
  29.     mov    dx,[maxx]
  30.  
  31. ; removed all range checking on x,y for speed
  32.  
  33.     mov    dx, 640            ; what a stupid way to do this
  34.     mul    dx                    ;640 bytes wide in most cases
  35.     add    bx,ax
  36.     adc    dx,0
  37.     mov    ax, dx            ; what a $#%%# stupid microprocessor
  38.     shl    ax, 1
  39. ; don't bother with current bank check since this looks faster
  40.  
  41.     mov    dx, 03cdh
  42.     out    dx, ax
  43.     mov    dx,0a000h        ;setup screen segment A000
  44.     mov    es,dx
  45.     mov    bx, ax            ; damm $#%$#%$# stupid micro
  46.     mov    ax, [color]        ;get color of pixel to plot
  47.     mov    es:[bx], ax
  48. ;    inc    dx
  49. ;    mov    es:[dx], ah
  50. nope1:    ret
  51. point_hi    endp
  52.  
  53.  
  54. point    proc    xpos:word,ypos:word,color:word
  55.     mov    bx,[xpos]
  56.     mov    ax,[ypos]
  57.     mov    dx,[maxx]
  58. ;    cmp    bx,0            ; range checking not necessary since it will
  59. ;    jl    nope2                ;  always be within one 64k bank
  60. ;    cmp    bx,dx
  61. ;    jge    nope2
  62. ;    cmp    ax,0
  63. ;    jl    nope2
  64. ;    cmp    ax,[maxy]
  65. ;    jge    nope2
  66.     mul    [xwidth]            ;640 bytes wide in most cases
  67.     add    bx,ax
  68.     adc    dx,0
  69.     mov    ax,dx
  70.     cmp    ax,[curbk]
  71.     jz    nonew
  72.     call    newbank            ;switch banks if a new bank entered
  73. nonew:    mov    ax,0a000h        ;setup screen segment A000
  74.     mov    es,ax
  75.     mov    al,byte ptr [color]    ;get color of pixel to plot
  76.     mov    es:[bx],al
  77. nope2:    ret
  78. point    endp
  79.  
  80.     end
  81.  
  82.